<?php
    namespace Model;
    
    use Fuel\Core\DB;

//Modelo usuariosCrud-->
class HotelesCrud{
        
        public static function agregar_hotel($datos){
            $hotel = Hoteles::forge($datos);
            
            if ($hotel->save()) {
                return $hotel->hotelId;
            }else
            {
                $errors = array();
                
                foreach($hotel->validation()->$error as $error => $validation){
                    $errors[$error] = $validation->get_messsage();
                }
              return $errors;
            }
            
        }
        
        public static function select_one_hotel($id){
            
            if ($hotel = Usuarios::find_by_pk($id)) {
                return $hotel->to_array();
            }else return false;
            
        }
        
        public static function delete_one_hotel($id){
        $hotel= Usuarios::find_by_pk($id);
        if($hotel){
            $hotel->delete();
        }else            return false;
                
    }
        
    }
?>
